{% extends "moban1788/base.html" %}
{% block head %}
        <script type="text/javascript">
            $(document).ready(function(){
                $("#is_online").click(function(){
                    var selectValue = document.getElementById('is_online');
                    if (selectValue.value == 2){
                        $("#u_host").show();
                    }
                    else
                    {
                       $("#u_host").hide();
                    }

                });
                $("#change_data").click(function(){
                    var u_username = $("#u_username").val();
                    var u_password = $("#u_password").val();
                    var u_uid = $("#u_uid").val();
                    var u_nickname = $("#u_nickname").val();
                    var u_host = $("#u_host").val();
                    var selectValue2 = document.getElementById('is_online');
                    if (selectValue2.value == 2 && u_host == ''){
                        sweetAlert("", "域名不能为空,请重新输入", "info");
                        return false;
                    }
                    if (u_username == ''){
                        sweetAlert("", "用户名不能为空,请输入uid", "info");
                        return false;
                    }
                    if (u_password == ''){
                        sweetAlert("", "密码不能为空,请重新输入", "info");
                        return false;
                    }
                    if (u_uid == ''){
                        sweetAlert("", "uid不能为空,请输入uid", "info");
                        return false;
                    }
                    if (u_nickname == ''){
                        sweetAlert("", "昵称不能为空,请重新输入", "info");
                        return false;
                    }
                });
                $("#run").click(function(){
        {#            $("#loading").show();#}
                    var groups = document.getElementById('inlineCheckbox1').checked;
                    var users = document.getElementById('inlineCheckbox2').checked;
                    var ticktocks = document.getElementById('inlineCheckbox3').checked;
                    var blued = document.getElementById('inlineCheckbox4').checked;
                    var h5 = document.getElementById('inlineCheckbox5').checked;
                    var pay = document.getElementById('inlineCheckbox6').checked;
                    {% if query_online == 0 %}
                        var passport = document.getElementById('inlineCheckbox7').checked;
                    {% else %}
                        var passport = false;
                    {% endif %}
                    if(groups==false && users ==false && ticktocks ==false && blued == false && h5==false && pay==false && passport ==false){
                        sweetAlert("", "大哥,好歹你也选一个啊", "info");
                        return false;
                    }
                });
            });
        </script>
{% endblock %}
{% block main %}
<div class="page-title cart-title">
  <div class="container-fluid">
    <div class="row">
          <div style="display: {{ config_style }};margin-top: 6%">
            <div class="col-md-3">
            </div>
            <div class="col-md-6" style="height: 100px">
                <h4 style="text-align: center;"><p style="color: white">修改运行配置</p></h4>
                <form method="get" style="margin-top: 2%">
                    <select name="is_online" id="is_online" class="form-control" style="width: 100%;margin-top: 1%;width: 70%;margin-left: 15%;">
                        <option value=1>线上环境</option>
                        <option value=0>测试环境</option>
                        <option value=2>Other</option>
                    </select>
                    <p>
                        <input class="form-control" type="text" name="u_host" id="u_host" placeholder="HOST" style="margin-top: 3%;width: 70%;margin-left: 15%;display: none"/>
                        <input class="form-control" type="text" name="u_username" id="u_username" placeholder="用户名" style="margin-top: 3%;width: 70%;margin-left: 15%;"/>
                        <input class="form-control" type="text" name="u_password" id="u_password" placeholder="密码" style="margin-top: 3%;width: 70%;margin-left: 15%;"/>
                        <input class="form-control" type="text" name="u_uid" id="u_uid" placeholder="uid" style="margin-top: 3%;width: 70%;margin-left: 15%;"/>
                        <input class="form-control" type="text" name="u_nickname" id="u_nickname" placeholder="昵称" style="margin-top: 3%;width: 70%;margin-left: 15%;"/>
                    </p>
                    <input name="change_data" id="change_data" class="form-control btn btn-primary" type="submit" value="修改" style="margin-top: 3%;width: 70%;margin-left: 15%;"/>
                </form>
            </div>
        </div>
      <div class="col-md-12 text-center p-static" style="display: {{ table_style }}">
        <div class="page-heading">
          <h2 class="white text-uppercase fz-36 ls-2">接口自动化日志</h2>
          <h6 class="work-sans fz-15 white mt-20">首页   <span class="mlr-10"> / </span>  自动化日志</h6>
        </div>
      </div>
    </div>
  </div>
</div>
<section class="pt-150" style="display: {{ table_style }}">
    <div class="container">
        <div class="row">
            <div class="col-md-12 text-center">
                <h1 class="text-uppercase ls-3 bb gray-de"><span class="yellow"> 接口自动化日志-</span> Test</h1>
                <p class="mt-50 fz-15">
                    测试环境下接口自动化日志的采集,展示,以及网页运行接口自动化脚本.
                </p>
            </div>
        </div>
        <div class="row mt-50" style="margin-bottom: 2%;display: {{ table_style }}">
            <div class = "col-lg-6">
                <form method="get">
                    <b style="margin-left: 3%">选择接口模块:</b>
                    <br>
                    <label class="checkbox-inline" style="margin-top: 3%;margin-bottom: 1%; margin-left: 3%">
                      <input type="checkbox" id="inlineCheckbox1" name= 'groups' value="groups"> groups
                    </label>
                    <label class="checkbox-inline" style="margin-top: 3%;margin-bottom: 1%; {% if query_online == 0 %}margin-left: 1.5%{% else %}margin-left: 5%{% endif %}">
                      <input type="checkbox" id="inlineCheckbox2" name="users" value="users"> users
                    </label>
                    <label class="checkbox-inline" style="margin-top: 3%;margin-bottom: 1%;{% if query_online == 0 %}margin-left: 1.5%{% else %}margin-left: 5%{% endif %}">
                      <input type="checkbox" id="inlineCheckbox3" name="ticktocks" value="ticktocks"> ticktocks
                    </label>
                    <label class="checkbox-inline" style="margin-top: 3%;margin-bottom: 1%;{% if query_online == 0 %}margin-left: 1.5%{% else %}margin-left: 5%{% endif %}">
                      <input type="checkbox" id="inlineCheckbox4" name="blued" value="blued"> blued
                    </label>
                    <label class="checkbox-inline" style="margin-top: 3%;margin-bottom: 1%;{% if query_online == 0 %}margin-left: 1.5%{% else %}margin-left: 5%{% endif %}">
                      <input type="checkbox" id="inlineCheckbox5" name="h5" value="h5"> H5
                    </label>
                    <label class="checkbox-inline" style="margin-top: 3%;margin-bottom: 1%;{% if query_online == 0 %}margin-left: 1.5%{% else %}margin-left: 5%{% endif %}">
                      <input type="checkbox" id="inlineCheckbox6" name="pay" value="pay"> pay
                    </label>
                    {% if query_online == 0 %}
                    <label class="checkbox-inline" style="margin-top: 3%;margin-bottom: 1%;margin-left: 1%">
                      <input type="checkbox" id="inlineCheckbox7" name="passport" value="passport"> passport
                    </label>
                    {% endif %}
{#                            <br>#}
                    <input name="run" id="run" class="btn btn-primary btn-block" style="align-content: right;margin-left: 3%;margin-top: 10px; width: 95%" type="submit" value="run"/>
                </form>
            </div>
            <div class = "col-lg-6">
                <form method="get" style="margin-left: 15%">
                    <b>接口详情:</b>
                    <br>
                    <div style="margin-top: 3%;">
                        <font style="color: #9A999F;margin-top: 42px">
                            <b>运行环境:</b>&nbsp;&nbsp;{{ environment }}
                            <b style="margin-left: 8%;">用户:</b>&nbsp;&nbsp;{{ query_username }}
                            <div style="display: {{ uid_style }}">
                            <b style="margin-left: 8%;">uid:</b>&nbsp;&nbsp;{{ query_uid }}
                            </div>
                        </font>
                        <input name="btn_select" id="btn_select" class="btn btn-primary btn-block" style="align-content: right;margin-top: 18px;width: 90%;" type="submit" value="更改配置"/>
                    </div>
                </form>
            </div>
        </div>
          <div class="col-md-12" style="display: {{ table_style }}">
            <div class="table-responsive">
              <table class="table my-cart no-margin">
                <thead>
                  <tr>
                    <th class="col-md-2">端口</th>
                    <th class="col-md-2" style="text-align: center;">接口</th>
                    <th class="col-md-1">结果</th>
                    <th class="col-md-1">模块</th>
                    <th class="col-md-2">用例</th>
                    <th class="col-md-2">时间</th>
                    <th class="col-md-1">操作</th>
                  </tr>
                </thead>
                <tbody>
                    {% for show in atserverlist.object_list %}
                        <tr {% if show.result == 0 %}class="danger"{% endif %}{% if show.result == 1 %}class="success"{% else %}class="active"{% endif %}>
                            <div>
                                <td>{{ show.host }}</td>
                                <td>
                                    <div style="position:relative;width: 300px;height:auto; overflow-x:auto">
                                    {{ show.interface }}
                                    </div>
                                </td>
                                <td>{{ show.result_describe }}</td>
                                <td>{{ show.module }}</td>
                                <td>
                                   {{ show.casename }}
                                </td>
                                <td>{{ show.time }}</td>
                                <td style="text-align: center;">
                                    <a href="../detail/?id={{ show.id }}" style="font-size: 14px">详情</a>
                                </td>
                            </div>
                        </tr>
                    {% empty %}
                        <tr>
                            暂无数据
                        </tr>
                    {% endfor %}
                </tbody>
              </table>
            <div class="row col-lg-12" style="text-align: center; margin-top: 2%">
                <span class="step-links">
                    <ul class="pager">
                     {% if atserverlist.has_previous %}
                     <li class="prev">
                         <a href="?page={{ atserverlist.previous_page_number }}" class="previous" style="font-size: 14px">上一页</a>
                     </li>
                     {% endif %}
                     第 {{ atserverlist.number }}/{{ atserverlist.paginator.num_pages }} 页
                     {% if atserverlist.has_next %}
                         <li class="prev">
                             <a href="?page={{ atserverlist.next_page_number }}" style="font-size: 14px">下一页</a>
                         </li>
                     {% endif %}
                        <li class="next"><a style="font-size: 14px">共{{ atserver.count }}条</a>
                    </ul>
                </span>
            </div>
            </div>
            </div>
          </div>
        </div>
    </div>
</section>
{% endblock %}
{% block js %}
    <script src="../../../qa/static/js/plugins/morris/raphael.min.js"></script>
    <script src="../../../qa/static/js/plugins/morris/morris.min.js"></script>
    <script src="../../../qa/static/js/plugins/morris/morris-data.js"></script>
    <script src="../../../qa/static/js/sweet-alert.min.js"></script>
    <link rel="stylesheet" type="text/css" href="../../../qa/static/css/sweet-alert.css">
    <script src="../../../qa/static/js_new/jquery-1.12.4.min.js"></script>
    <script src="../../../qa/static/js_new/bootstrap.min.js"></script>
{% endblock %}